

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>5.7. UCTB.utils package &mdash; UCTB  documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="UCTB  documentation" href="index.html"/>
        <link rel="up" title="5. API Reference" href="APIReference.html"/>
        <link rel="next" title="6. Results on different datasets" href="md_file/all_results.html"/>
        <link rel="prev" title="5.6. UCTB.train package" href="UCTB.train.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> UCTB
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <ul>
<li class="toctree-l1"><a class="reference internal" href="md_file/introduction.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/installation.html">2. Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/quickstart.html">3. Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/tutorial.html">4. Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="APIReference.html">5. API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/all_results.html">6. Results on different datasets</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">UCTB</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          













<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="APIReference.html">5. API Reference</a> &raquo;</li>
        
      <li>5.7. UCTB.utils package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/UCTB.utils.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="uctb-utils-package">
<h1>5.7. UCTB.utils package<a class="headerlink" href="#uctb-utils-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-UCTB.utils.multi_threads">
<span id="uctb-utils-multi-threads-module"></span><h2>5.7.1. UCTB.utils.multi_threads module<a class="headerlink" href="#module-UCTB.utils.multi_threads" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="UCTB.utils.multi_threads.multiple_process">
<code class="sig-prename descclassname">UCTB.utils.multi_threads.</code><code class="sig-name descname">multiple_process</code><span class="sig-paren">(</span><em class="sig-param">distribute_list</em>, <em class="sig-param">partition_func</em>, <em class="sig-param">task_func</em>, <em class="sig-param">n_jobs</em>, <em class="sig-param">reduce_func</em>, <em class="sig-param">parameters</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.utils.multi_threads.multiple_process" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>distribute_list</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a>) – The “data” list to be partitioned, such as a list of files which will be
distributed among different tasks and each task process a part of the files.</p></li>
<li><p><strong>partition_func</strong> (<em>function</em>) – Partition function will be used to cut the distribute_list, it should accept
three inputs: distribute_list, i, n_job, where i is the index of jobs (i.e. integer from 0 to n_jobs-1),
n_jos is the number of threads; partition function should return a data_list for the job_i</p></li>
<li><p><strong>task_func</strong> (<em>function</em>) – Task function, where the inputs are share_queue, locker, data, parameters, no return.
pls refer to the DiDi-Data processing codes for more information.</p></li>
<li><p><strong>n_jobs</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – Number of threads</p></li>
<li><p><strong>reduce_func</strong> (<em>function</em>) – Reduce function which combine the outputs from all the threads into one final output.</p></li>
<li><p><strong>parameters</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)"><em>list</em></a>) – parameters send to the task function</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="md_file/all_results.html" class="btn btn-neutral float-right" title="6. Results on different datasets" accesskey="n">Next →</a>
      
      
        <a href="UCTB.train.html" class="btn btn-neutral" title="5.6. UCTB.train package" accesskey="p">← Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, UCTB group.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE: 'true'
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>
      <script type="text/javascript" src="_static/language_data.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>